home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 05.zip / BS1 part 5 / SASC_6.0_Disk_4.adf / Compiler_Headers / Include / libraries / gadtools.h < prev    next >
C/C++ Source or Header  |  1992-07-30  |  12KB  |  304 lines

  1. #ifndef LIBRARIES_GADTOOLS_H
  2. #define LIBRARIES_GADTOOLS_H
  3. /*
  4. **    $Filename: libraries/gadtools.h $
  5. **    $Release: 2.04 Includes, V37.4 $
  6. **    $Revision: 36.18 $
  7. **    $Date: 91/10/09 $
  8. **
  9. **    gadtools.library definitions
  10. **
  11. **    (C) Copyright 1989-1991 Commodore-Amiga, Inc.
  12. **    All Rights Reserved
  13. */
  14.  
  15. /*------------------------------------------------------------------------*/
  16.  
  17. #ifndef EXEC_TYPES_H
  18. #include <exec/types.h>
  19. #endif
  20.  
  21. #ifndef UTILITY_TAGITEM_H
  22. #include <utility/tagitem.h>
  23. #endif
  24.  
  25. #ifndef INTUITION_INTUITION_H
  26. #include <intuition/intuition.h>
  27. #endif
  28.  
  29. /*------------------------------------------------------------------------*/
  30.  
  31. /*  The kinds (almost classes) of gadgets in the toolkit.  Use these
  32.     identifiers when calling CreateGadgetA() */
  33.  
  34. #define GENERIC_KIND    0
  35. #define BUTTON_KIND    1
  36. #define CHECKBOX_KIND    2
  37. #define INTEGER_KIND    3
  38. #define LISTVIEW_KIND    4
  39. #define MX_KIND        5
  40. #define NUMBER_KIND    6
  41. #define CYCLE_KIND    7
  42. #define PALETTE_KIND    8
  43. #define SCROLLER_KIND    9
  44. /* Kind number 10 is reserved */
  45. #define SLIDER_KIND    11
  46. #define STRING_KIND    12
  47. #define TEXT_KIND    13
  48.  
  49. #define NUM_KINDS    14
  50.  
  51. /*------------------------------------------------------------------------*/
  52.  
  53. /*  These two definitions are obsolete, but are here for backwards
  54.     compatibility.  You never need to worry about these: */
  55. #define GADTOOLBIT    (0x8000)
  56. /*  Use this mask to isolate the user part: */
  57. #define GADTOOLMASK    (~GADTOOLBIT)
  58.  
  59. /*------------------------------------------------------------------------*/
  60.  
  61. /*  'Or' the appropriate set together for your Window IDCMPFlags: */
  62.  
  63. #define ARROWIDCMP    (IDCMP_GADGETUP | IDCMP_GADGETDOWN |\
  64.     IDCMP_INTUITICKS | IDCMP_MOUSEBUTTONS)
  65.  
  66. #define BUTTONIDCMP    (IDCMP_GADGETUP)
  67. #define CHECKBOXIDCMP    (IDCMP_GADGETUP)
  68. #define INTEGERIDCMP    (IDCMP_GADGETUP)
  69. #define LISTVIEWIDCMP    (IDCMP_GADGETUP | IDCMP_GADGETDOWN |\
  70.     IDCMP_MOUSEMOVE | ARROWIDCMP)
  71.  
  72. #define MXIDCMP        (IDCMP_GADGETDOWN)
  73. #define NUMBERIDCMP    (NULL)
  74. #define CYCLEIDCMP    (IDCMP_GADGETUP)
  75. #define PALETTEIDCMP    (IDCMP_GADGETUP)
  76.  
  77. /*  Use ARROWIDCMP|SCROLLERIDCMP if your scrollers have arrows: */
  78. #define SCROLLERIDCMP    (IDCMP_GADGETUP | IDCMP_GADGETDOWN | IDCMP_MOUSEMOVE)
  79. #define SLIDERIDCMP    (IDCMP_GADGETUP | IDCMP_GADGETDOWN | IDCMP_MOUSEMOVE)
  80. #define STRINGIDCMP    (IDCMP_GADGETUP)
  81.  
  82. #define TEXTIDCMP    (NULL)
  83.  
  84. /*------------------------------------------------------------------------*/
  85.  
  86. /*  Typical suggested spacing between "elements": */
  87. #define INTERWIDTH    8
  88. #define INTERHEIGHT    4
  89.  
  90. /*------------------------------------------------------------------------*/
  91.  
  92. /*  Generic NewGadget used by several of the gadget classes: */
  93.  
  94. struct NewGadget
  95.     {
  96.     WORD ng_LeftEdge, ng_TopEdge;    /*  gadget position */
  97.     WORD ng_Width, ng_Height;        /*  gadget size */
  98.     UBYTE *ng_GadgetText;        /*  gadget label */
  99.     struct TextAttr *ng_TextAttr;    /*  desired font for gadget label */
  100.     UWORD ng_GadgetID;            /*  gadget ID */
  101.     ULONG ng_Flags;            /*  see below */
  102.     APTR ng_VisualInfo;            /*  Set to retval of GetVisualInfo() */
  103.     APTR ng_UserData;            /*  gadget UserData */
  104.     };
  105.  
  106.  
  107. /*  ng_Flags control certain aspects of the gadget.  The first five control
  108.     the placement of the descriptive text.  All larger groups supply a
  109.     default: */
  110.  
  111. #define PLACETEXT_LEFT    0x0001    /* Right-align text on left side */
  112. #define PLACETEXT_RIGHT    0x0002    /* Left-align text on right side */
  113. #define PLACETEXT_ABOVE    0x0004    /* Center text above */
  114. #define PLACETEXT_BELOW    0x0008    /* Center text below */
  115. #define PLACETEXT_IN    0x0010    /* Center text on */
  116.  
  117. #define NG_HIGHLABEL    0x0020    /* Highlight the label */
  118.  
  119. /*------------------------------------------------------------------------*/
  120.  
  121. /* Fill out an array of these and pass that to CreateMenus(): */
  122.  
  123. struct NewMenu
  124.     {
  125.     UBYTE nm_Type;        /*  See below */
  126.     /* Compiler inserts a PAD byte here */
  127.     STRPTR nm_Label;        /*  Menu's label */
  128.     STRPTR nm_CommKey;        /*  MenuItem Command Key Equiv */
  129.     UWORD nm_Flags;        /*  Menu or MenuItem flags (see note) */
  130.     LONG nm_MutualExclude;    /*  MenuItem MutualExclude word */
  131.     APTR nm_UserData;        /*  For your own use, see note */
  132.     };
  133.  
  134. /*  Each nm_Type should be one of these: */
  135. #define NM_TITLE    1
  136. #define NM_ITEM        2
  137. #define NM_SUB        3
  138. #define NM_END        0
  139.  
  140. #define MENU_IMAGE    128
  141.  
  142. /* For an image menu-item or sub-item, use one of these.  Set
  143.  * nm_Label to point at the Image structure you wish to use.
  144.  * NOTE: At present, you may only use conventional images.
  145.  * Custom images created from Intuition image-classes do not work.
  146.  */
  147. #define IM_ITEM        (NM_ITEM | MENU_IMAGE)
  148. #define IM_SUB        (NM_SUB | MENU_IMAGE)
  149.  
  150. /*  If you set your label to NM_BARLABEL, you'll get a separator bar. */
  151. #define NM_BARLABEL    ((STRPTR)-1)
  152.  
  153.  
  154. /*  The nm_Flags field is used to fill out either the Menu->Flags or
  155.     MenuItem->Flags field.  Note that the sense of the MENUENABLED or
  156.     ITEMENABLED bit is inverted between this use and Intuition's use,
  157.     in other words, NewMenus are enabled by default.  The following
  158.     labels are provided to disable them: */
  159. #define NM_MENUDISABLED    MENUENABLED
  160. #define NM_ITEMDISABLED    ITEMENABLED
  161.  
  162. /*  The following are pre-cleared (COMMSEQ, ITEMTEXT, and HIGHxxx are set
  163.     later as appropriate): */
  164. #define NM_FLAGMASK    (~(COMMSEQ | ITEMTEXT | HIGHFLAGS))
  165.  
  166. /*  You may choose among CHECKIT, MENUTOGGLE, and CHECKED.
  167.     Toggle-select menuitems are of type CHECKIT|MENUTOGGLE, along
  168.     with CHECKED if currently selected.  Mutually exclusive ones
  169.     are of type CHECKIT, and possibly CHECKED too.  The nm_MutualExclude
  170.     is a bit-wise representation of the items excluded by this one,
  171.     so in the simplest case (choose 1 among n), these flags would be
  172.     ~1, ~2, ~4, ~8, ~16, etc.  See the Intuition Menus chapter. */
  173.  
  174. /*  A UserData pointer can be associated with each Menu and MenuItem structure.
  175.     The CreateMenus() call allocates space for a UserData after each
  176.     Menu or MenuItem (header, item or sub-item).  You should use the
  177.     GTMENU_USERDATA() or GTMENUITEM_USERDATA() macro to extract it. */
  178.  
  179. #define GTMENU_USERDATA(menu) (* ( (APTR *)(((struct Menu *)menu)+1) ) )
  180. #define GTMENUITEM_USERDATA(menuitem) (* ( (APTR *)(((struct MenuItem *)menuitem)+1) ) )
  181.  
  182. /*  Here is an old one for compatibility.  Do not use in new code! */
  183. #define MENU_USERDATA(menuitem) (* ( (APTR *)(menuitem+1) ) )
  184.  
  185. /*  These return codes can be obtained through the GTMN_SecondaryError tag */
  186. #define GTMENU_TRIMMED    0x00000001    /* Too many menus, items, or subitems,
  187.                        menu has been trimmed down */
  188. #define GTMENU_INVALID    0x00000002    /* Invalid NewMenu array */
  189. #define GTMENU_NOMEM    0x00000003    /* Out of memory */
  190.  
  191. /*------------------------------------------------------------------------*/
  192.  
  193. /*  Tags for toolkit functions: */
  194.  
  195. #define GT_TagBase         TAG_USER + 0x80000
  196.  
  197. #define GTVI_NewWindow         GT_TagBase+1  /* Unused */
  198. #define GTVI_NWTags         GT_TagBase+2  /* Unused */
  199.  
  200. #define GT_Private0         GT_TagBase+3  /* (private) */
  201.  
  202. #define GTCB_Checked         GT_TagBase+4  /* State of checkbox */
  203.  
  204. #define GTLV_Top         GT_TagBase+5  /* Top visible one in listview */
  205. #define GTLV_Labels         GT_TagBase+6  /* List to display in listview */
  206. #define GTLV_ReadOnly         GT_TagBase+7  /* TRUE if listview is to be
  207.                           read-only */
  208. #define GTLV_ScrollWidth     GT_TagBase+8  /* Width of scrollbar */
  209.  
  210. #define GTMX_Labels         GT_TagBase+9  /* NULL-terminated array of labels */
  211. #define GTMX_Active         GT_TagBase+10 /* Active one in mx gadget */
  212.  
  213. #define GTTX_Text         GT_TagBase+11 /* Text to display */
  214. #define GTTX_CopyText         GT_TagBase+12 /* Copy text label instead of
  215.                           referencing it */
  216.  
  217. #define GTNM_Number         GT_TagBase+13 /* Number to display */
  218.  
  219. #define GTCY_Labels         GT_TagBase+14 /* NULL-terminated array of labels */
  220. #define GTCY_Active         GT_TagBase+15 /* The active one in the cycle gad */
  221.  
  222. #define GTPA_Depth         GT_TagBase+16 /* Number of bitplanes in palette */
  223. #define GTPA_Color         GT_TagBase+17 /* Palette color */
  224. #define GTPA_ColorOffset     GT_TagBase+18 /* First color to use in palette */
  225. #define GTPA_IndicatorWidth  GT_TagBase+19 /* Width of current-color indicator */
  226. #define GTPA_IndicatorHeight GT_TagBase+20 /* Height of current-color indicator */
  227.  
  228. #define GTSC_Top         GT_TagBase+21 /* Top visible in scroller */
  229. #define GTSC_Total         GT_TagBase+22 /* Total in scroller area */
  230. #define GTSC_Visible         GT_TagBase+23 /* Number visible in scroller */
  231. #define GTSC_Overlap         GT_TagBase+24 /* Unused */
  232.  
  233. /*  GT_TagBase+25 through GT_TagBase+37 are reserved */
  234.  
  235. #define GTSL_Min         GT_TagBase+38 /* Slider min value */
  236. #define GTSL_Max         GT_TagBase+39 /* Slider max value */
  237. #define GTSL_Level         GT_TagBase+40 /* Slider level */
  238. #define GTSL_MaxLevelLen     GT_TagBase+41 /* Max length of printed level */
  239. #define GTSL_LevelFormat     GT_TagBase+42 /* Format string for level */
  240. #define GTSL_LevelPlace      GT_TagBase+43 /* Where level should be placed */
  241. #define GTSL_DispFunc         GT_TagBase+44 /* Callback for number calculation
  242.                           before display */
  243.  
  244. #define GTST_String         GT_TagBase+45 /* String gadget's displayed string */
  245. #define GTST_MaxChars         GT_TagBase+46 /* Max length of string */
  246.  
  247. #define GTIN_Number         GT_TagBase+47 /* Number in integer gadget */
  248. #define GTIN_MaxChars         GT_TagBase+48 /* Max number of digits */
  249.  
  250. #define GTMN_TextAttr         GT_TagBase+49 /* MenuItem font TextAttr */
  251. #define GTMN_FrontPen         GT_TagBase+50 /* MenuItem text pen color */
  252.  
  253. #define GTBB_Recessed         GT_TagBase+51 /* Make BevelBox recessed */
  254.  
  255. #define GT_VisualInfo         GT_TagBase+52 /* result of VisualInfo call */
  256.  
  257. #define GTLV_ShowSelected    GT_TagBase+53 /* show selected entry beneath
  258.         listview, set tag data = NULL for display-only, or pointer
  259.         to a string gadget you've created */
  260. #define GTLV_Selected         GT_TagBase+54 /* Set ordinal number of selected
  261.                           entry in the list */
  262. #define GT_Reserved1         GT_TagBase+56 /* Reserved for future use */
  263.  
  264. #define GTTX_Border         GT_TagBase+57 /* Put a border around
  265.                           Text-display gadgets */
  266. #define GTNM_Border         GT_TagBase+58 /* Put a border around
  267.                           Number-display gadgets */
  268.  
  269. #define GTSC_Arrows         GT_TagBase+59 /* Specify size of arrows for
  270.                           scroller */
  271.  
  272. #define GTMN_Menu         GT_TagBase+60 /* Pointer to Menu for use by
  273.                           LayoutMenuItems() */
  274. #define GTMX_Spacing         GT_TagBase+61 /* Added to font height to
  275.         figure spacing between mx choices.  Use this instead
  276.         of LAYOUTA_SPACING for mx gadgets. */
  277.  
  278. /* New to V37 GadTools.  Ignored by GadTools V36 */
  279. #define GTMN_FullMenu         GT_TagBase+62 /* Asks CreateMenus() to
  280.         validate that this is a complete menu structure */
  281. #define GTMN_SecondaryError  GT_TagBase+63 /* ti_Data is a pointer
  282.         to a ULONG to receive error reports from CreateMenus() */
  283. #define GT_Underscore         GT_TagBase+64 /* ti_Data points to the symbol
  284.         that preceeds the character you'd like to underline in a
  285.         gadget label */
  286. #define GTST_EditHook         GT_TagBase+55 /* String EditHook */
  287.  
  288. /*  GT_TagBase+65 on up reserved for future use */
  289.  
  290. /* Old definition, now obsolete: */
  291. #define GT_Reserved0         GTST_EditHook
  292.  
  293. /*------------------------------------------------------------------------*/
  294.  
  295. /*  "NWay" is an old synonym for cycle gadgets */
  296. #define NWAY_KIND    CYCLE_KIND
  297. #define NWAYIDCMP    CYCLEIDCMP
  298. #define GTNW_Labels    GTCY_Labels
  299. #define GTNW_Active    GTCY_Active
  300.  
  301. /*------------------------------------------------------------------------*/
  302.  
  303. #endif /* LIBRARIES_GADTOOLS_H */
  304.